<#include "/includes/son.ftl" >

<div class="container-fluid" style="margin-top: 15px;">
    <div class="row">
        <div class="col-md-12">
            <div class="card">
                <div class="card-body">
                    <form id="form1" class="form-horizontal" action="/goods/shopGoods/goodsEditDo" method="post"
                          enctype="multipart/form-data">
                        <input type="hidden" name="id" <#if shopGoods??>value="${shopGoods.id}"</#if> >
                        <div class="form-group">
                            <label class="col-xs-2" for="example-text-input">分类名称</label>
                            <div class="col-xs-10">
                                <select name="shopTypeId" id="shopTypeId"  class="form-control">
                                    <#if shopGoodsTypeList??>
                                        <#list shopGoodsTypeList as sgt>
                                            <option value="${sgt.id}" <#if shopGoods??><#if shopGoods.shopTypeId== sgt.id > selected="selected"</#if></#if> >${sgt.typeName}</option>
                                        </#list>
                                    </#if>
                                </select>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-xs-2" for="example-text-input">商品名称</label>
                            <div class="col-xs-10">
                                <input class="form-control" type="text" id="shopGoods" name="shopGoods" placeholder="分类名称" <#if shopGoods??>value="${shopGoods.shopGoods}"</#if>  >
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-xs-2" for="example-text-input">商品数量</label>
                            <div class="col-xs-10">
                                <input class="form-control" type="text" id="shopGoodsCount" name="shopGoodsCount" placeholder="商品数量" <#if shopGoods??>value="${shopGoods.shopGoodsCount}"</#if>  >
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-xs-2" for="example-text-input">商品价格（分）</label>
                            <div class="col-xs-10">
                                <input class="form-control" type="text" id="shopGoodsPrice" name="shopGoodsPrice" placeholder="商品价格" <#if shopGoods??>value="${shopGoods.shopGoodsPrice?string('0')}"</#if>  >
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-xs-2" for="example-text-input">商品图片</label>

                            <div class="col-xs-8">
                                <input  type="file" id="file" name="file">
                            </div>
                            <div class="col-xs-2">
                                <img src="<#if shopGoods??>${shopGoods.shopGoodsImg}</#if>" style="width:100px">
                            </div>
                        </div>


                        <div class="form-group">
                            <div class="col-xs-12">
                                <input class="btn btn-primary" type="button" value="提交" id="doSub"/>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    $(function () {
        $('#doSub').click(function () {
            $('#form1').ajaxSubmit(function (data) {
                if (data.status == 200) {
                    lightyear.notify(data.data, 'success', 100);
                } else {
                    lightyear.notify(data.data, 'danger', 100);
                }
                window.location.href = document.referrer;
            });
        });
    });


</script>